<?php
namespace app\web\validate;

use think\Validate;


class TicketValidate extends Validate {

    /**
     * 字段验证规则
     *
     * @var array
     */
    protected $rule = [
        'name'  => 'require|max:100',
        'type' => 'require|number|between:1,2',
        'quota' => 'require|number',
        'term' => 'require|number|between:1,1000',
        'expire_day' => 'require|number|between:1,1000',
        'use_shop' => 'number',
        'remarks' => 'max:1000',
    ];


    /**
     * 字段验证规则提示
     *
     * @var array
     */
    protected $message  =   [
        'name.require' => '票券名称必填',
        'name.max'     => '票券名称最多不能超过100个字符',
        'type.require'   => '票券类型必填',
        'type.number'   => '票券类型必须是数字',
        'type.between'   => '票券类型只能在1-2之间',
        'quota.require'  => '票券额度必填',
        'quota.number'  => '票券额度必须是数字',
        'term.require'   => '有效期限天必填',
        'term.number'    => '有效期限天必须是数字',
        'term.between'  => '有效期限天只能在1-1000之间',
        'expire_day.require'   => '到期多少天前通知必填',
        'expire_day.number'    => '到期多少天前通知必须是数字',
        'expire_day.between'  => '到期多少天前通知只能在1-1000之间',
        'use_shop.number'          => '优惠券可使用店铺必须是数字',
        'remarks.max'          => '备注最多不能超过1000个字符',
    ];


    protected $scene = [
        'add'=>['name','type','quota','term','expire_day','remarks'],
        'edit'=>['name','type'],
    ];




}